import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import { Sidebar, SidebarItem, Icon, SwipeCell } from 'vant';
import './assets/style/global.css';

const app = createApp(App);

document.addEventListener('touchstart', function(event) {
    if (event.touches.length > 1) {
        event.preventDefault();
    }
}, { passive: false });

document.addEventListener('touchmove', function(event) {
    if (event.touches.length > 1) {
        event.preventDefault();
    }
}, { passive: false });

let lastTouchEnd = 0;
document.addEventListener('touchend', function(event) {
    const now = Date.now();
    if (now - lastTouchEnd < 300) {
        event.preventDefault();
    }
    lastTouchEnd = now;
}, { passive: false });

app.use(router);
app.use(Sidebar);
app.use(SidebarItem);
app.use(Icon);
app.use(SwipeCell);
app.mount('#app');